<?php

/**
 * 后台管理相关接口
 *
 * @author Samuel
 * @since 2012.4.6
 */
class AdminController extends BaseController {
    /**
     * 加载用户登录页面
     */
    public function run() {
        include TPL_DIR . 'main.php';
    }
    /**
     * 加载后台主页面
     */
    public function main(){
        include TPL_DIR .'main.php';
        
    }
    /**
     * 加载后台课程管理
     */
     public function Course(){
        $CourseInfo = Course_Choose::getInstance()->getAllCourse();
        include TPL_DIR .'course.php';
    }
    /**
     * 加载课程添加
     */
    public function add(){
     
      $fCourse = Course_Choose::getInstance()->getCourseList();
      include TPL_DIR .'addCourse.php';
    }
    /**
     * 加载课程修改
     */
    public function edit(){ 
        $id = $this->getParamInt( 'id' , true , true );
        $courseInfo = Course_Manage::getInstance()->courseOnly( $id );
        $fCourse = Course_Choose::getInstance()->getCourseList();
        include TPL_DIR .'editCourse.php';
    }
    /**
     * 学员信息管理
     */
    public function student(){
        $student = User_Info::getInstance()->userBaseList();
        foreach( $student as $key => $value ){
            $studentInfo = User_Info::getInstance()->userExtendList( $value['uId']);
            $studentAllInfo[$value['uId']] = array(
                'name' => $value['name'],
                'email'=> $value['email'],
                'headPic'=> $value['headPic'],
                'sex' =>  $studentInfo['sex'],
                'mobile'=>$studentInfo['mobile'],
                'birth' =>$studentInfo['birth'],
                'addr' =>$studentInfo['addr'],
                'totalDays' =>$studentInfo['totalDays'],
                'lastLogin' =>date('Y-m-d h:i:s' ,$studentInfo['lastLogin']),
                'registerTime' =>date('Y-m-d h:i:s' ,$studentInfo['registerTime'])
                
                
            );
        }
        include TPL_DIR .'student.php';
        
    }
    
}
